import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import TypeNav from '@/components/TypeNav'
import store from '@/store'
import '@/mock/mockServe.js'
import "swiper/css/swiper.css";
import Carsousel from '@/components/Carsousel'
import Pagination from '@/components/Pagination'
import * as api from '@/api'
import { MessageBox, Pagination as Pag } from 'element-ui'
import VueLazyload from 'vue-lazyload'
import '@/plugins/validate.js'
// 图片懒加载
const loadimage= require('./assets/loading.gif')
const errorimage = require('./assets/loading.gif')
Vue.use(VueLazyload, {
  error: errorimage,
  loading: loadimage
})
// element ui
Vue.prototype.$msgbox = MessageBox
Vue.prototype.$alert = MessageBox.alert
Vue.use(Pag)
// 自创全局组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carsousel.name, Carsousel)
Vue.component(Pagination.name, Pagination)
Vue.config.productionTip = false

new Vue({
  render: h => h(App), router, store,
  beforeCreate() {
    // 布置全局时间线
    Vue.prototype.$bus = this
    Vue.prototype.$api = api
  }
}).$mount('#app')


